<?php
include_once '../includes/common.php';
if($islogin2==1){}else sysmsg("您还未登录，请先登录",2,'./login.php',true);
if(isset($_GET['uid'])) {
$uid=isset($_GET['uid'])?intval($_GET['uid']):sysmsg("参数错误",2,'./shop.php',true);
if ($uid != 1) {
    $row=$DB->get_row("SELECT * FROM authguao_user WHERE uid='{$uid}' limit 1");
    if(!$row)sysmsg("授权平台不存在该店铺",2,'./shop.php',true);
    if($row['status']!=1)sysmsg("该店铺因违规，已被管理员封禁",2,'./shop.php',true);
}
$title='店铺首页';
include_once './header.php';
if ($uid == 1) {
    if($conf['admin_qq']){
        $qq=$conf['admin_qq'];
    }else{
        $qq=$conf['kfqq'];
    }
    $gxqm=$conf['gxqm'];
} else {
    $qq = $row['qq'];
    $gxqm=$row['gxqm'];
}
$shopcount=$DB->count("SELECT count(*) from authguao_shop WHERE uid='{$uid}'");
$shopcount1=$DB->count("SELECT count(*) from authguao_shop WHERE uid='{$uid}' and type=1");
$shopcount2=$DB->count("SELECT count(*) from authguao_shop WHERE uid='{$uid}' and type=2");
$shopcount3=$DB->count("SELECT count(*) from authguao_shop WHERE uid='{$uid}' and type=3");
?>
  <link href="https://cdn.staticfile.org/Swiper/4.5.1/css/swiper.min.css" rel="stylesheet">
  <link href="../assets/layui/style/admin.css" rel="stylesheet" media="all">
  <link href="../assets/layui/style/template.css" rel="stylesheet" media="all">
  <style>
    .auth_input {
        width: calc(100% - 3em);
        height: 2.4em;
        text-align: left;
        margin-top: 0.4em;
        border: none;
        background-color: whitesmoke;
        text-indent: 1em;
        border-radius: 0.3em 0.0em 0em 0.3em;
    }

    .auth_colas {
        width: 16em;
        height: 3em;
        background-color: white;
        display: flex;
        float: right;
        padding: 0;
        margin: 0;
        border-radius: 0.5em;
        margin-right: 0.5em;
        transition: all 0.3s;
    }

    .auth_colas a {
        width: 3em;
        height: 2.4em;
        background-color: whitesmoke;
        margin-top: 0.4em;
        border-radius: 0.0em 0.3em 0.3em 0.0em;
        cursor: pointer;
    }

    .auth_colas a:hover {
        color: mediumslateblue;
    }

    .fleott a {
        width: auto;
        text-align: center;
        height: 3em;
        line-height: 3em;
        display: flex;
        float: left;
        display: block;
        cursor: pointer;
        transition: all 0.3s;
        padding: 0 1em 0 1em;
    }

    .fleott a:hover {
        color: #f20d0d;
    }

    @media only screen and (min-width: 700px) {
        .auth_colas {
            width: 35em;
        }
    }

    .auth_active {
        background: rgba(242, 13, 13, .06);
        border-radius: 6px;
        font-weight: 700;
        color: #f20d0d;
    }

    .auth_biaot {
        position: absolute;
        top: 0em;
        right: 0em;
        height: 2em;
        display: block;
    }

    .auth_left {
        position: absolute;
        top: 1.35em;
        right: 0em;
        height: 2em;
        display: block;
    }
    .auth_div {
        overflow: hidden;
    }

    @media only screen and (min-width: 700px) {
        .auth_div {
            margin-top: 0.5em;
        }
    }

    .auth_a_image {
        height: 17em !important;
        display: block;
        overflow: hidden;
    }

    .auth_image {
        width: 100%;
        transition: all 0.4s;
    }

    .auth_image:hover {
        -webkit-transform: scale(2) rotate(3deg);
        -moz-transform: scale(2) rotate(3deg);
        -o-transform: scale(2) rotate(3deg);
    }

    .layui-layer-imgbar {
        display: block !important;
    }
    .image_body {
        height: 100px;
        overflow: hidden;
        padding: 0;
        padding-bottom: 1rem;
        text-align: center;
        margin-bottom: 1rem;
    }
    </style>
<style type="text/css">
    .authguao_image {
        width: 100%;
        height: 10rem;
        margin-bottom: 1rem;
    }
    @media only screen and (max-width: 700px) {
        .authguao_image {height: 3rem;}
    }
</style>
    <div class="layui-row layui-col-space8">
        <div class="layui-col-xs12 layui-col-sm8 layui-col-sm-offset2">
            <div class="layadmin-homepage-panel layadmin-homepage-shadow">
                <div class="layui-card text-center">
                    <div class="layui-card-body">
                        <div class="layadmin-homepage-pad-ver">
                            <img class="layadmin-homepage-pad-img" src="http://q1.qlogo.cn/g?b=qq&nk=<?php echo $qq?>&s=100&t=1547904810" width="96" height="96">
                        </div>
                        <h4 class="layadmin-homepage-font" title="自动获取QQ昵称"><?php echo qqname($qq)?></h4>
                        <p class="layadmin-homepage-min-font"><a><?php echo $gxqm?></a></p>
                        <div class="layadmin-homepage-pad-ver">
                            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-sm">共投稿了<?php echo $shopcount?>个商品!</a>
                        </div>
                    </div>
                </div>
                <p class="layadmin-homepage-about">关于店铺</p>
                <ul class="layadmin-homepage-list-group">
                    <li class="list-group-item"><i class="layui-icon layui-icon-username"></i>店铺ID：<?php echo $uid?></li>
                    <li class="list-group-item"><a href="javascript:;" class="color"><i class="layui-icon layui-icon-login-qq"></i><span style="word-wrap:break-word;"><?php echo $qq?></span></a></li>
                </ul>
                <div class="layadmin-homepage-pad-hor"><mdall></mdall></div>
                <p class="layadmin-homepage-about">投稿</p>
                <ul class="layadmin-homepage-list-inline">
                    <a href="javascript:;" class="layui-btn layui-btn-primary">投稿了<?php echo $shopcount1?>个模板</a>
                    <a href="javascript:;" class="layui-btn layui-btn-primary">投稿了<?php echo $shopcount2?>个插件</a>
                    <a href="javascript:;" class="layui-btn layui-btn-primary">投稿了<?php echo $shopcount3?>个其他</a>
                </ul>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm8 layui-col-sm-offset2">
            <div class="layui-card">
                <div class="layui-card-header">他的投稿商品</div>
                <div class="layui-card-body">
                    <?php
                    $rs=$DB->query("SELECT * FROM authguao_shop WHERE uid='{$uid}' order by id asc");
                    while($res = $DB->fetch($rs))
                    {
                    $shopimg = explode(',', $res['image']);
                    echo '<div class="layui-row layui-col-space8">
                        <div class="layui-col-xs3">
                            <div class="layui-card">
                                <img src="'.$shopimg[0].'" onclick="image_msg('.$res['id'].')" class="authguao_image" />
                                <div class="layui-text layui-elip" style="text-align: center;height:2rem">
                                    <a href="shop_details.php?id='.$res['id'].'" lay-text="商品'.$res['name'].'详情页" title="'.$res['name'].'" style="font-size:0.7rem">'.$res['name'].'</a>
                                </div>
                            </div>
                        </div>
                    </div>';
                    }
                    ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
include_once './bottom.php';
?>
<script type="text/javascript">
function image_msg(id) {
    $.getJSON('ajax.php?act=image_shop&id=' + id, function (json) {
        layer.photos({photos: json, anim: 5});
    });
}
</script>
<?php
}else{
    sysmsg("参数错误",2,'./',true);
}
?>